package com.witframework.web.tag.tab;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

public class panelBodyTag extends BodyTagSupport
  implements tabbedpanel
{
  private String className = null;
  private String style = null;
  private String src = null;

  public void setClassName(String paramString)
  {
    this.className = paramString;
  }

  public String getClassName()
  {
    return this.className;
  }

  public void setStyle(String paramString)
  {
    this.style = paramString;
  }

  public String getStyle()
  {
    return this.style;
  }

  public void setSrc(String paramString)
  {
    this.src = paramString;
  }

  public String getSrc()
  {
    return this.src;
  }

  public int doAfterBody()
    throws JspException
  {
    BodyContent localBodyContent;
    String str = "";
    if (this.src == null)
    {
      localBodyContent = getBodyContent();
      if (localBodyContent != null)
        str = localBodyContent.getString();
    }
    else
    {
      localBodyContent = this.pageContext.pushBody();
      try
      {
        this.pageContext.include(this.src);
      }
      catch (Exception localException)
      {
        throw new JspException("tabPanel: Could not include file " + this.src);
      }
      if (localBodyContent != null)
        str = localBodyContent.getString();
      this.pageContext.popBody();
    }
    panelTag localpanelTag = (panelTag)findAncestorWithClass(this, panelTag.class);
    if (localpanelTag == null)
      throw new JspException("tabpanel: Could not find ancestor for Body");
    PanelBody localPanelBody = new PanelBody();
    localPanelBody.setContent(str.trim());
    if (this.className != null)
      localPanelBody.setClassName(this.className);
    if (this.style != null)
      localPanelBody.setStyle(this.style);
    localpanelTag.setPanel(localPanelBody);
    localBodyContent.clearBody();
    return 0;
  }

  public int doEndTag()
  {
    dropData();
    return 6;
  }

  public void release()
  {
    dropData();
  }

  private void dropData()
  {
    this.className = null;
    this.style = null;
    this.src = null;
  }
}